<?php

namespace App\Http\Controllers\Estate;

use App\Http\Controllers\Controller;
use App\Http\Requests\Mini\Estate\ElectricRequest;
use App\Services\ElectricService;

class ElectricController extends Controller
{

    protected $service;

    public function __construct(ElectricService $electricService)
    {
        $this->service = $electricService;
    }

    /**
     * Notes: 保电和拉合闸
     * User: lstink
     * Date: 2021/3/19
     * Time: 10:07 上午
     * @param ElectricRequest $request
     * @return array
     */
    public function store(ElectricRequest $request)
    {
        $params = $request->all();
        $result = $this->service->changeControl($params);
        return $result['status'] ? $this->success($result['data'], $result['msg']) : $this->error($result['msg']);
    }

    /**
     * Notes: 保电拉合闸数据
     * User: lstink
     * Date: 2021/3/19
     * Time: 10:09 上午
     */
    public function show($id)
    {
        $result = $this->service->controlInfo($id);
        return $result['status'] ? $this->success($result['data'], $result['msg']) : $this->error($result['msg']);
    }
}
